package org.x.usermod.service;


import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import org.springframework.transaction.annotation.Transactional;
import org.x.commonmod.config.BusinessException;
import org.x.commonmod.config.Result;
import org.x.usermod.dto.*;
import org.x.usermod.entity.SysUser;
import org.x.usermod.entity.SysUserRealnameAuth;
import org.x.usermod.vo.LoginVO;
import org.x.usermod.vo.SysUserVO;
import org.x.usermod.vo.UserInfoVO;

/**
 * 用户表 服务层。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
public interface ISysUserService extends IService<SysUser> {

    int createUser(CreateUserDTO createUserDTO) throws BusinessException;


    boolean isUsernameExists(@NotBlank(message = "用户名不能为空") String username);

    boolean isPhoneExists(@NotBlank(message = "手机号不能为空") String mobile);

    Result createUserWithValidation(CreateUserDTO createUserDTO);
    @Transactional
    int updateUser(UpdateUserDTO updateUserDTO) throws BusinessException;

    Result updateUserWithValidation(UpdateUserDTO updateUserDTO) throws BusinessException;

    LoginVO login(LoginDTO loginDTO) throws BusinessException;
    @Transactional
    Result removeById(Long id);
    @Transactional
    Result restoreById(Long id);
    Result getById(Long id);

    Page<SysUserVO> List(ListDto listDto);

    Result resetPassword(@Valid ResetPasswordDTO resetPasswordDTO);
    @Transactional
    Result resetMobile(@Valid ResetMobileDTO resetMobileDTO);

    UserInfoVO getUserAuthInfo();

    PersonalInfoDTO getProfile();

    /**
     * 获取用户实名认证信息
     * @param userId
     * @return
     */
    SysUserRealnameAuth getSysUserRealnameAuth(@Valid Long userId);

    Result submitRealnameAuth(@Valid SURrealnamAuthDTO sysUserRealnameAuthDTO,Long userId);

    Result updateProfile(UpdateProfileDTO updateProfileDTO);

    Result verifyRealnameAuth(@Valid AuthVerifyDTO authVerifyDTO);

    Result getAuthPendingList(RealnameAuthPageDTO realnameAuthPageDTO);
}
